package demo3;

public class OuterClass2 {
    public int data1 = 1;
    private int data2 = 2;
    public static final int DATA3 = 3;

    // 静态内部类
    static class InnerClass{

        public int data1 = 1111;
        public int data4 = 4;
        private int data5 = 5;
        public static final int data6 = 6;

        public void testInner(){
            System.out.println("testInner方法执行了...");
            OuterClass2 outerClass2 = new OuterClass2();
            System.out.println(outerClass2.data1);
            System.out.println(outerClass2.data2);


            System.out.println(data1);
            System.out.println(data4);
            System.out.println(data5);
            System.out.println(DATA3);
            System.out.println(data6);

        }
    }

    public static void staticTest(){
        // System.out.println(data1);
    }

    public void test(){
        System.out.println("test方法执行了...");
    }

    public void test2(){
        final int a = 10;
        // 局部内部类
        class Inner{
            public int data1 = 1;

            public void func(){
                System.out.println("func方法执行了..." + a);
            }

        }

        Inner inner = new Inner();
        inner.func();
    }
}
